package com.duowei.kitchenshow.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.duowei.kitchenshow.R;
import com.duowei.kitchenshow.bean.Cfpb_item;

import java.util.List;

public class RvRightAdapter extends BaseQuickAdapter<Cfpb_item> {
    public RvRightAdapter(int layoutResId,List<Cfpb_item> data) {
        super(layoutResId, data);
    }
    @Override
    protected void convert(BaseViewHolder baseViewHolder, Cfpb_item cfpb_item) {
        baseViewHolder.setText(R.id.tv_time,cfpb_item.fzs+"分钟")
                        .setText(R.id.tv_zh,"餐桌:"+cfpb_item.czmc1)
                        .setText(R.id.tv_name,cfpb_item.xmmc1+"\n"+cfpb_item.pz)
                        .setText(R.id.tv_num,cfpb_item.sl1+"")
                        .setText(R.id.tv_dw,cfpb_item.dw);
        if("外卖".equals(cfpb_item.getXszt())){
            baseViewHolder.setVisible(R.id.tv_dabao,true);
        }else{
            baseViewHolder.setVisible(R.id.tv_dabao,false);
        }

        //超时单品
        String cssj = cfpb_item.cssj;
        if("1".equals(cfpb_item.getBy10())){
            if(!TextUtils.isEmpty(cssj)&&cfpb_item.fzs>Integer.parseInt(cssj)){
                baseViewHolder.setBackgroundRes(R.id.ll_right,R.drawable.shape_outtime_click);
            }else{
                baseViewHolder.setBackgroundRes(R.id.ll_right,R.drawable.selector_brown_stroke);
            }
            baseViewHolder.setVisible(R.id.img_check,true);
        }else{
            if(!TextUtils.isEmpty(cssj)&&cfpb_item.fzs>Integer.parseInt(cssj)){
                baseViewHolder.setBackgroundRes(R.id.ll_right,R.drawable.shape_outtime_normal);
            }else{
                baseViewHolder.setBackgroundRes(R.id.ll_right,R.drawable.shape_orange_normal);
            }
            baseViewHolder.setVisible(R.id.img_check,false);
        }
    }
}
